// featurePackage/pages/companyWxService/companyWxService.js
const app = getApp();
import {
    SERVICE_URL,
    SERVICE_ID,
} from "../../../service/base_service"
import {
  randomServiceCode
} from "../../../service/jb_mine_service"
Page({

    /**
     * 页面的初始数据
     */
    data: {
        qrCode:'https://images.jiabao19.com/common/testqw.jpg',
        cWxUrl:"https://work.weixin.qq.com/gm/916d2d7a5d156ca3b2b6b2a2c0aabbd8",

    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {
      this.getRandomServiceCode();
    },

 

    /**
     * 生命周期函数--监听页面显示
     */
    onShow() {

    },
    pushToService(){
        wx.openCustomerServiceChat({
            extInfo: { url: SERVICE_URL },
            corpId: SERVICE_ID,
            success(res) { },
            fail(err) {
                console.log('调用失败:', err);
            }
        })
    },
    //获取随机客服企微二维码
    getRandomServiceCode(){
       wx.showLoading();
       randomServiceCode().then(res => {
          wx.hideLoading()
          if(res.code == 200){
            this.setData({
              qrCode:res.data
            })
          }
       }).catch(err => {
          wx.hideLoading()
       })
    },
    
})